# -*- coding: utf-8 -*-
"""
 @Time    : 2021/2/3 下午3:24
 @Author  : tgy
 
"""


class MyProperty:
    ...

    def __init__(self, fget=None, fset=None, fdel=None):
        ...
        self.fget = fget
        self.fset = fset
        self.fdel = fdel

    def setter(self, fset):
        ...
        self.fset = fset
        return type(self)(fget=self.fget,fset=fset)

    def deleter(self, fdel):
        ...
        self.fdel = fdel
        return type(self)(fget=self.fget,fdel=fdel)

    def __get__(self, instance, owner):
        print(owner)
        return self.fget(instance)

    def __set__(self, instance, value):
        self.fset(instance, value)


class Person:

    def __init__(self, name):
        self._name = name

    # @property
    @MyProperty
    def name(self):
        ...
        return self._name

    @name.setter
    def name(self, val):
        self._name = val

    @name.deleter
    def name(self):
        ...

    # print(name1 is name)

if __name__ == '__main__':
    ...
    per = Person('tony')
    per.name = 'lisi'
    # print(per.name)